<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>38.5. MiniAEFrame — Open Scripting Architecture server support &mdash; Python v2.6.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.2 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.2 documentation" href="../index.html" />
    <link rel="up" title="38. MacPython OSA Modules" href="macosa.html" />
    <link rel="next" title="39. SGI IRIX Specific Services" href="sgi.html" />
    <link rel="prev" title="38.4. aetypes — AppleEvent objects" href="aetypes.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="sgi.html" title="39. SGI IRIX Specific Services"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="aetypes.html" title="38.4. aetypes — AppleEvent objects"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="macosa.html" accesskey="U">38. MacPython OSA Modules</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-MiniAEFrame">
<h1>38.5. <tt class="xref docutils literal"><span class="pre">MiniAEFrame</span></tt> &#8212; Open Scripting Architecture server support<a class="headerlink" href="#module-MiniAEFrame" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p id="index-418">The module <tt class="xref docutils literal"><span class="pre">MiniAEFrame</span></tt> provides a framework for an application that can
function as an Open Scripting Architecture  (OSA) server, i.e. receive and
process AppleEvents. It can be used in conjunction with <a title="(Mac) Interactive application framework. (deprecated)" class="reference external" href="framework.html#module-FrameWork"><tt class="xref docutils literal"><span class="pre">FrameWork</span></tt></a> or
standalone. As an example, it is used in <strong>PythonCGISlave</strong>.</p>
<p>The <tt class="xref docutils literal"><span class="pre">MiniAEFrame</span></tt> module defines the following classes:</p>
<dl class="class">
<dt id="MiniAEFrame.AEServer">
<em class="property">
class </em><tt class="descclassname">MiniAEFrame.</tt><tt class="descname">AEServer</tt><a class="headerlink" href="#MiniAEFrame.AEServer" title="Permalink to this definition">¶</a></dt>
<dd>A class that handles AppleEvent dispatch. Your application should subclass this
class together with either <a title="MiniAEFrame.MiniApplication" class="reference internal" href="#MiniAEFrame.MiniApplication"><tt class="xref docutils literal"><span class="pre">MiniApplication</span></tt></a> or
<a title="FrameWork.Application" class="reference external" href="framework.html#FrameWork.Application"><tt class="xref docutils literal"><span class="pre">FrameWork.Application</span></tt></a>. Your <a title="object.__init__" class="reference external" href="../reference/datamodel.html#object.__init__"><tt class="xref docutils literal"><span class="pre">__init__()</span></tt></a> method should call the
<a title="object.__init__" class="reference external" href="../reference/datamodel.html#object.__init__"><tt class="xref docutils literal"><span class="pre">__init__()</span></tt></a> method for both classes.</dd></dl>

<dl class="class">
<dt id="MiniAEFrame.MiniApplication">
<em class="property">
class </em><tt class="descclassname">MiniAEFrame.</tt><tt class="descname">MiniApplication</tt><a class="headerlink" href="#MiniAEFrame.MiniApplication" title="Permalink to this definition">¶</a></dt>
<dd>A class that is more or less compatible with <a title="FrameWork.Application" class="reference external" href="framework.html#FrameWork.Application"><tt class="xref docutils literal"><span class="pre">FrameWork.Application</span></tt></a> but
with less functionality. Its event loop supports the apple menu, command-dot and
AppleEvents; other events are passed on to the Python interpreter and/or Sioux.
Useful if your application wants to use <a title="MiniAEFrame.AEServer" class="reference internal" href="#MiniAEFrame.AEServer"><tt class="xref docutils literal"><span class="pre">AEServer</span></tt></a> but does not provide
its own windows, etc.</dd></dl>

<div class="section" id="aeserver-objects">
<span id="id1"></span><h2>38.5.1. AEServer Objects<a class="headerlink" href="#aeserver-objects" title="Permalink to this headline">¶</a></h2>
<dl class="method">
<dt id="MiniAEFrame.AEServer.installaehandler">
<tt class="descclassname">AEServer.</tt><tt class="descname">installaehandler</tt><big>(</big><em>classe</em>, <em>type</em>, <em>callback</em><big>)</big><a class="headerlink" href="#MiniAEFrame.AEServer.installaehandler" title="Permalink to this definition">¶</a></dt>
<dd>Installs an AppleEvent handler. <em>classe</em> and <em>type</em> are the four-character OSA
Class and Type designators, <tt class="docutils literal"><span class="pre">'****'</span></tt> wildcards are allowed. When a matching
AppleEvent is received the parameters are decoded and your callback is invoked.</dd></dl>

<dl class="method">
<dt id="MiniAEFrame.AEServer.callback">
<tt class="descclassname">AEServer.</tt><tt class="descname">callback</tt><big>(</big><em>_object</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MiniAEFrame.AEServer.callback" title="Permalink to this definition">¶</a></dt>
<dd><p>Your callback is called with the OSA Direct Object as first positional
parameter. The other parameters are passed as keyword arguments, with the
4-character designator as name. Three extra keyword parameters are passed:
<tt class="docutils literal"><span class="pre">_class</span></tt> and <tt class="docutils literal"><span class="pre">_type</span></tt> are the Class and Type designators and <tt class="docutils literal"><span class="pre">_attributes</span></tt>
is a dictionary with the AppleEvent attributes.</p>
<p>The return value of your method is packed with <a title="aetools.packevent" class="reference external" href="aetools.html#aetools.packevent"><tt class="xref docutils literal"><span class="pre">aetools.packevent()</span></tt></a> and
sent as reply.</p>
</dd></dl>

<p>Note that there are some serious problems with the current design. AppleEvents
which have non-identifier 4-character designators for arguments are not
implementable, and it is not possible to return an error to the originator. This
will be addressed in a future release.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">38.5. <tt class="docutils literal"><span class="pre">MiniAEFrame</span></tt> &#8212; Open Scripting Architecture server support</a><ul>
<li><a class="reference external" href="#aeserver-objects">38.5.1. AEServer Objects</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="aetypes.html"
                                  title="previous chapter">38.4. <tt class="docutils literal docutils literal docutils literal"><span class="pre">aetypes</span></tt> &#8212; AppleEvent objects</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="sgi.html"
                                  title="next chapter">39. SGI IRIX Specific Services</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/miniaeframe.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sgi.html" title="39. SGI IRIX Specific Services"
             >next</a> |</li>
        <li class="right" >
          <a href="aetypes.html" title="38.4. aetypes — AppleEvent objects"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="macosa.html" >38. MacPython OSA Modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; <a href="../copyright.html">Copyright</a> 1990-2009, Python Software Foundation.
      Last updated on Apr 15, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>